package com.abss.vote.mapper;

import com.abss.vote.model.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface UserMapper {

    int verification(@Param("TELEPHONE") String TELEPHONE,@Param("ACTIVITY_ID") int ACTIVITY_ID);

    int singUp(UserWorkVo userWorkVo);

    int getParticipantsCount(int ACTIVITY_ID);

    int getParticipantsCounts(@Param("ACTIVITY_ID")int ACTIVITY_ID,@Param("DISTRICT_ID")int DISTRICT_ID);

    int checkSingUp(@Param("ACTIVITY_ID") int ACTIVITY_ID,@Param("USER_ID") String USER_ID);

    UserWorkVo getUser(UserWorkVo userWorkVo);

    int updateSingUp(UserWorkVo userWorkVo);

    List<DistrictListUserWorkVo> getWorkByUserName(@Param("NAME") String NAME,@Param("ACTIVITY_ID") int ACTIVITY_ID);

    String getUserName(String USER_ID);

    List<DistrictListUserWorkVo> getWorkByVotesNumber();

    int addUserVotes(User user);

    int addUser(userCallBack userCallBack);

    int checkUser(userCallBack userCallBack);

    int updateUser(userCallBack userCallBack);

    User getUserVoteInfo(User user);

    List<User> getUserInfo(String USER_ID);

    int updateUserVotesInfo(User user);

    int subUserVotesInfo(User user);

    List<DistrictListUserWorkVo> getUserRegInfo(@Param("USER_NAME") String USER_NAME,@Param("ACTIVITY_ID") int ACTIVITY_ID);

    List<DistrictListUserWorkVo> getUserRegInfos(@Param("USER_NAME") String USER_NAME,@Param("ACTIVITY_ID") int ACTIVITY_ID, 
            @Param("districtIdList")List<Integer> districtIdList);

    Integer getVoteUserNum(int ACTIVITY_ID);

    List<User> getUserPage(@Param("NICKNAME") String NICKNAME);
    List<User> getUserPages(@Param("NICKNAME") String NICKNAME,@Param("server_id") String server_id);

    int delUser(@Param("user_id")String user_id,@Param("activity_id") int activity_id);

    int addUserRegInfo(UserRegInfo userRegInfo);

    int updUserRegInfo(UserRegInfo userRegInfo);

    UserRegInfo getUserReg(@Param("user_id")String user_id,@Param("activity_id") int activity_id);


    int createUser(UserWorkVo userWorkVo);

    int addUserBack(UserWorkVo userWorkVo);

    @Select("select USER_ID from WORK where WORK_ID=#{work_id}")
    String getUserId(@Param("work_id") Integer work_id);

    int updateUserRegInfo(UserWorkVo work);

    @Select("select * from [USER] where USER_ID = #{user_id}")
    User checkUserInfo(@Param("user_id") String user_id);

    int updateUserRegStatus(UserRegInfo userRegInfo);
}
